Truncation

When applying truncation, place the full text in a title attribute so that it’s accessible on hover.

Single Lineprototype

Preview

Code

<dl class="slds-size--1-of-2">
  <dt class="slds-text-heading--label">Field 4</dt>
  <dd>
    <p class="slds-truncate">Long text field with many lines and truncation will look like this. Even though the text might go on for ages and ages.</p>
  </dd>
</dl>

Component Overview

If problems occur when using truncation with elements that use flexbox, you might need to add the .slds-has-flexi-truncate class on the flexbox child node ( .slds-col or .slds-col--padded elements) that contains the truncated text.

Usage

This table gives you a quick overview of the SLDS CSS classes that can be applied to this component.
Class NameUsage
.slds-truncate
Applied to:

any element

Outcome:

Creates truncated text

Required:

No, optional element or modifier

Comments:

Truncation will occur at the parent width if a width is not specified

.slds-has-flexi-truncate
Applied to:

.slds-col
.slds-col--padded

Outcome:

Allows truncation in nested flexbox containers

Required:

No, optional element or modifier

Comments:

This class is placed on a parent element that contains a flexbox element containing .slds-truncate. For example — for a media object that is nested in a grid column and contains truncation — the grid column would require this class.